/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.com.cotelasa.scp.controlador;

/**
 *
 * @author Jorge
 */
import java.io.Serializable;  
import javax.inject.Named;
  
import javax.faces.application.FacesMessage;  
import javax.faces.context.FacesContext;  
import javax.faces.event.ActionEvent;
  
import org.primefaces.event.FileUploadEvent;  
import org.primefaces.model.UploadedFile;
import org.springframework.context.annotation.Scope;
import pe.com.cotelasa.common.controlador.MBGenerico;
import pe.com.cotelasa.scp.common.IObserver;

@Named(value = "FileUploadController")
@Scope("request")
public class FileUploadController extends MBGenerico implements IMantenedor, IObserver, Serializable{
     private UploadedFile file;  
  
    public UploadedFile getFile() {  
        return file;  
    }  
  
    public void setFile(UploadedFile file) {  
        this.file = file;  
    }  
  
    public void upload() {  
        if(file != null) {  
            FacesMessage msg = new FacesMessage("Succesful", file.getFileName() + " is uploaded.");  
            FacesContext.getCurrentInstance().addMessage(null, msg);  
        }  
    }  

    public void handleFileUpload(FileUploadEvent event) {  
        FacesMessage msg = new FacesMessage("El Archivo", event.getFile().getFileName() + " se adjunto correctamente.");  
        FacesContext.getCurrentInstance().addMessage(null, msg);  
    } 
    
    @Override
    public String actualizar() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public String guardar() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void eliminar(ActionEvent actionEvent) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public String editar() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public String nuevo() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public String ver() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public String aceptar() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public String retroceder() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public String cancelar() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void actualizarObservador(Object object) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

   
}
